package com.lem.security.controller;

import com.lem.security.po.Result;
import com.lem.security.po.User;
import com.lem.security.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    @RequestMapping("/user/login")
    public Result login(@RequestBody User user){
        System.out.println(user);
        Result login = loginService.login(user);
        System.out.println(login);
        System.out.println("登录成功");
        return login;
    }
    @PostMapping("/user/logout")
    public Result logout(){
        return loginService.logout();
    }
}
